<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<title>3PCAP man page</title>
<meta name="generator" content="roffit">
<STYLE type="text/css">
pre {
  overflow: auto;
  margin: 0;
}

P.level0, pre.level0 {
 padding-left: 2em;
}

P.level1, pre.level1 {
 padding-left: 4em;
}

P.level2, pre.level2 {
 padding-left: 6em;
}

span.emphasis {
 font-style: italic;
}

span.bold {
 font-weight: bold;
}

span.manpage {
 font-weight: bold;
}

h2.nroffsh {
 background-color: #e0e0e0;
}

span.nroffip {
 font-weight: bold;
 font-size: 120%;
 font-family: monospace;
}

p.roffit {
 text-align: center;
 font-size: 80%;
}
</STYLE>
</head><body>

<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2>
<p class="level0">pcap_setnonblock, pcap_getnonblock - set or get the state of non-blocking mode on a capture device <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2>
<p class="level0"><pre class="level0">
&#35;include &lt;pcap/pcap.h&gt;
<pre class="level0">
char errbuf[PCAP_ERRBUF_SIZE];
int pcap_setnonblock(pcap_t *p, int nonblock, char *errbuf);
int pcap_getnonblock(pcap_t *p, char *errbuf);
</pre>

<p class="level0"><a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2>
<p class="level0"><span Class="bold">pcap_setnonblock()</span> puts a capture handle into ``non-blocking&#39;&#39; mode, or takes it out of ``non-blocking&#39;&#39; mode, depending on whether the <span Class="emphasis">nonblock</span> argument is non-zero or zero.  It has no effect on ``savefiles&#39;&#39;. If there is an error, <span Class="bold">PCAP_ERROR</span> is returned and <span Class="emphasis">errbuf</span> is filled in with an appropriate error message; otherwise, 0 is returned. In ``non-blocking&#39;&#39; mode, an attempt to read from the capture descriptor with <span Class="bold">pcap_dispatch(3PCAP)</span> will, if no packets are currently available to be read, return 0 immediately rather than blocking waiting for packets to arrive. <a Class="bold" href="./pcap_loop.html">pcap_loop</a> and <span Class="bold">pcap_next(3PCAP)</span> will not work in ``non-blocking&#39;&#39; mode. 
<p class="level0">When first activated with <a Class="bold" href="./pcap_activate.html">pcap_activate</a> or opened with <span Class="bold">pcap_open_live(3PCAP) ,</span> a capture handle is not in ``non-blocking mode&#39;&#39;; a call to <span Class="bold">pcap_setnonblock()</span> is required in order to put it into ``non-blocking&#39;&#39; mode. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2>
<p class="level0"><span Class="bold">pcap_getnonblock()</span> returns the current ``non-blocking&#39;&#39; state of the capture descriptor; it always returns 0 on ``savefiles&#39;&#39;. If there is an error, <span Class="bold">PCAP_ERROR</span> is returned and <span Class="emphasis">errbuf</span> is filled in with an appropriate error message. 
<p class="level0"><span Class="emphasis">errbuf</span> is assumed to be able to hold at least <span Class="bold">PCAP_ERRBUF_SIZE</span> chars. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2>
<p class="level0"><a Class="bold" href="./pcap.html">pcap</a>(3PCAP), <a Class="bold" href="./pcap_next_ex.html">pcap_next_ex</a>(3PCAP), <a Class="bold" href="./pcap_geterr.html">pcap_geterr</a>(3PCAP) <p class="roffit">
 This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>.
</body></html>
